package EBM.UI;

import java.io.IOException;
import java.util.ArrayList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;

import EBM.BLL.SocketConnection;
import EBM.BLL.Util;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class EMProcess extends org.eclipse.swt.widgets.Composite {
	private TabFolder tabFolder1;
	private TableColumn tableColumn1;
	private TableColumn tableColumn2;
	private TableColumn tableColumn3;
	private TableColumn tableColumn4;
	private TabItem tabItem5;
	private TabItem tabItem4;
	private TabItem tabItem3;
	private TabItem tabItem2;
	private TabItem tabItem1;
	private Combo combo12;
	private Combo cboAssignResponsibility;
	private Combo cboClose;
	private Combo cboAssignReview;
	private Combo cboRecur;
	private Combo cboSeverity;
	private Combo cboProId;
	private Combo cboProVersion;
	private Combo cboSubsys;
	private Text txtHard;
	private Text txtSoft;
	private Composite composite5;
	private Composite cptModify;
	private Composite composite3;
	private Composite cptReview;
	private Composite cptReport;
	private Button btnSubmitValidate;
	// private Button button18;
	// private Button button17;
	private Button btnFailed;
	private Button btnPass;
	private Button btnSubmitModify;
	private Button btnValidate;
	private Button button12;
	private Button button11;
	private Button btnChangeReview;
	private Button btnReviewAgain;
	private Button btnModifyExecute;
	private Button btnSubmitReview;
	private Button btnBugHang;
	private Button btnUserSubmit;
	private Button btnAssignResponsibility;
	private Button btnClose;
	private Button btnAssignReview;
	private Text txtBugSummary;
	private Text txtBugAttach;
	private Text txtModifyDescription;
	private Text txtModifyComment;
	private Text txtBugCause;
	private Text txtComment;
	private Text txtAttach;
	private Text txtTime;
	private Text txtSubmit;
	private Text txtBugId;
	private Label lblValidate;
	private Label label26;
	private Label lblBugAttach;
	private Label lblModifyDescription;
	private Label label23;
	private Label lblModifyComment;
	private Label lblBugCause;
	private Label lblAssignNext;
	private Label lblComment;
	private Label lblAttach;
	private Label lblRecurStep;
	private Label lblRecur;
	private Label lblBugDetail;
	private Label lblBugSummary;
	private Button btnSubmitReport;
	private Button btnSaveReport;
	private Table table1;
	private Composite composite6;
	private TabItem tabItem6;
	private Label lblSeverity;
	private Label lblSoft;
	private Label lblHard;
	private Label lblSubsys;
	private Label lblProVersion;
	private Label lblProId;
	private Label lblTime;
	private Label lblSubmit;
	private Label lblBugId;
	// private Label label1;

	public static Display display;
	public static Shell shell;
	private Text txtRecurStep;
	private Text txtBugDetail;
	private Combo cboPriority;
	private Label lblPriority;
	private Composite composite7;
	public static String ebmsID; // 缺陷的单号
	public static String proID;
	public static String userType;
	public static String userName;

	public static String responpeo;
	public static String days;
	public static String wtgyms;
	public static String status;
	public static String isEdit;

	private MessageBox box = new MessageBox(shell, SWT.YES | SWT.ICON_WARNING);
	private MessageBox box1 = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION);
	private MessageBox box2 = new MessageBox(shell, SWT.YES | SWT.ICON_ERROR);

	private ArrayList<String> BugReportProjectId = new ArrayList<String>();
	private ArrayList<String> BugReportProjectName = new ArrayList<String>();

	private ArrayList<String> BugReportUserId = new ArrayList<String>();
	private ArrayList<String> BugReportUserName = new ArrayList<String>();

	// add
	Group cptReportGroup1, cptReportGroup2, cptReportGroup3, cptReportGroup4;
	Group cptReviewGroup1;
	Group composite3Group;
	Group cptModifyGroup;
	Group composite5Group;
	Composite compositeTab;
	

	/**
	 * Auto-generated main method to display this
	 * org.eclipse.swt.widgets.Composite inside a new Shell.
	 */
	/*public static void main(String[] args) {
		showGUI();
	}*/

	/**
	 * Auto-generated method to display this org.eclipse.swt.widgets.Composite
	 * inside a new Shell.
	 */
	public static void showGUI() {
		display = Display.getDefault();
		shell = new Shell(display, SWT.CLOSE | SWT.MIN);
		EMProcess inst = new EMProcess(shell, SWT.NULL);
		Point size = inst.getSize();
		shell.setLayout(new FillLayout());
		shell.layout();
		shell.setText("缺陷报告单处理");
		if (size.x == 0 && size.y == 0) {
			inst.pack();
			shell.pack();
		} else {
			Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y);
			shell.setSize(shellBounds.width, shellBounds.height);
		}
		shell
				.setLocation(display.getClientArea().width / 2
						- shell.getSize().x / 2, display.getClientArea().height
						/ 2 - shell.getSize().y / 2);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	public EMProcess(org.eclipse.swt.widgets.Composite parent, int style) {
		super(parent, style);
		initGUI();
		InitProId();
		if (isEdit.equals("false")) {
			cptReport.setEnabled(false);
			cptReview.setEnabled(false);
			composite3.setEnabled(false);
			cptModify.setEnabled(false);
			composite5.setEnabled(false);
			composite6.setEnabled(false);
			InitShowAll();
		} else if (isEdit.equals("true")) {
			InitAll();
		}
	}

	private void initGUI() {
		try {
			this.setLayout(new FormLayout());
			this.setSize(726, 475);

			{
				// compositeTab = new Composite(this,SWT.NONE);
				FormData compositeLData = new FormData();
				compositeLData.width = 585;
				compositeLData.height = 228;
				compositeLData.left = new FormAttachment(178, 1000, 0);
				compositeLData.right = new FormAttachment(984, 1000, 0);
				compositeLData.top = new FormAttachment(220, 1000, 0);
				compositeLData.bottom = new FormAttachment(700, 1000, 0);
				// compositeTab.setLayoutData(compositeLData);

				tabFolder1 = new TabFolder(this, SWT.NO_RADIO_GROUP
						| SWT.EMBEDDED);
				FormData tabFolder1LData = new FormData();
				tabFolder1LData.width = 756;
				tabFolder1LData.height = 446;
				tabFolder1LData.left = new FormAttachment(0, 1000, 0);
				tabFolder1LData.top = new FormAttachment(0, 1000, 79);
				tabFolder1.setLayoutData(tabFolder1LData);
				// tabFolder1.setLayoutData(new
				// GridData(GridData.FILL,GridData.FILL,true,false));
				{
					tabItem1 = new TabItem(tabFolder1, SWT.NONE);
					tabItem1.setText("      缺陷报告      ");

					{
						cptReport = new Composite(tabFolder1, SWT.NONE);
						cptReport.setLayout(null);
						cptReportGroup1 = new Group(cptReport, SWT.NONE);
						cptReportGroup2 = new Group(cptReport, SWT.NONE);
						cptReportGroup3 = new Group(cptReport, SWT.NONE);
						cptReportGroup4 = new Group(cptReport, SWT.NONE);

						cptReportGroup1.setBounds(12, 0, 345, 183);
						cptReportGroup1.setText("\u57fa\u672c\u4fe1\u606f");
						cptReportGroup2.setBounds(12, 189, 345, 173);
						cptReportGroup2.setText("\u7f3a\u9677\u63cf\u8ff0");
						cptReportGroup3.setBounds(379, 1, 330, 178);
						cptReportGroup3.setText("\u91cd\u73b0\u4fe1\u606f");
						cptReportGroup4.setBounds(379, 224, 326, 92);
						cptReportGroup4
								.setText("\u4e0b\u4e00\u6b65\u5904\u7406");

						tabItem1.setControl(cptReport);
						{
							lblBugId = new Label(this, SWT.NONE);
							lblBugId.setText("缺陷报告单ID：");
							FormData label2LData = new FormData();
							label2LData.width = 77;
							label2LData.height = 21;
							label2LData.left = new FormAttachment(23, 1000, 0);
							label2LData.right = new FormAttachment(125, 1000, 0);
							label2LData.top = new FormAttachment(28, 1000, 0);
							label2LData.bottom = new FormAttachment(75, 1000, 0);
							lblBugId.setLayoutData(label2LData);
						}
						{
							txtBugId = new Text(this, SWT.NONE);
							FormData text1LData = new FormData();
							text1LData.width = 77;
							text1LData.height = 21;
							text1LData.left = new FormAttachment(151, 1000, 0);
							text1LData.right = new FormAttachment(257, 1000, 0);
							text1LData.top = new FormAttachment(25, 1000, 0);
							text1LData.bottom = new FormAttachment(72, 1000, 0);
							txtBugId.setLayoutData(text1LData);
						}
						{
							lblSubmit = new Label(this, SWT.NONE);
							lblSubmit.setText("提交人：");
							FormData label3LData = new FormData();
							label3LData.width = 68;
							label3LData.height = 28;
							label3LData.left = new FormAttachment(347, 1000, 0);
							label3LData.right = new FormAttachment(437, 1000, 0);
							label3LData.top = new FormAttachment(28, 1000, 0);
							label3LData.bottom = new FormAttachment(90, 1000, 0);
							lblSubmit.setLayoutData(label3LData);
						}
						{
							txtSubmit = new Text(this, SWT.NONE);
							txtSubmit.setEditable(false);
							FormData text2LData = new FormData();
							text2LData.width = 79;
							text2LData.height = 21;
							text2LData.left = new FormAttachment(445, 1000, 0);
							text2LData.right = new FormAttachment(553, 1000, 0);
							text2LData.top = new FormAttachment(28, 1000, 0);
							text2LData.bottom = new FormAttachment(75, 1000, 0);
							txtSubmit.setLayoutData(text2LData);
						}
						{
							lblTime = new Label(this, SWT.NONE);
							lblTime.setText("提交时间：");
							FormData label4LData = new FormData();
							label4LData.width = 65;
							label4LData.height = 21;
							label4LData.left = new FormAttachment(658, 1000, 0);
							label4LData.right = new FormAttachment(744, 1000, 0);
							label4LData.top = new FormAttachment(28, 1000, 0);
							label4LData.bottom = new FormAttachment(75, 1000, 0);
							lblTime.setLayoutData(label4LData);
						}
						{
							txtTime = new Text(this, SWT.NONE);
							txtTime.setEditable(false);
							FormData text3LData = new FormData();
							text3LData.width = 86;
							text3LData.height = 20;
							text3LData.left = new FormAttachment(751, 1000, 0);
							text3LData.right = new FormAttachment(869, 1000, 0);
							text3LData.top = new FormAttachment(28, 1000, 0);
							text3LData.bottom = new FormAttachment(72, 1000, 0);
							txtTime.setLayoutData(text3LData);
						}
						{
							lblProId = new Label(cptReportGroup1, SWT.NONE);
							lblProId.setText("项目ID");
							lblProId.setBounds(21, 25, 47, 21);
						}
						{
							cboProId = new Combo(cptReportGroup1, SWT.READ_ONLY);
							cboProId.setBounds(93, 25, 60, 20);
						}
						{
							lblProVersion = new Label(cptReportGroup1, SWT.NONE);
							lblProVersion.setText("版本");
							lblProVersion.setBounds(169, 25, 35, 20);
						}
						{
							cboProVersion = new Combo(cptReportGroup1, SWT.READ_ONLY);
							cboProVersion.setBounds(210, 25, 55, 25);
						}
						{
							lblSubsys = new Label(cptReportGroup1, SWT.NONE);
							lblSubsys.setText("\u5b50\u7cfb\u7edf");
							lblSubsys.setBounds(21, 62, 54, 19);
						}
						{
							cboSubsys = new Combo(cptReportGroup1, SWT.READ_ONLY);
							cboSubsys.setBounds(93, 57, 86, 25);
						}
						{
							lblHard = new Label(cptReportGroup1, SWT.NONE);
							lblHard.setText("硬件环境");
							lblHard.setBounds(23, 96, 60, 20);
						}
						{
							txtHard = new Text(cptReportGroup1, SWT.BORDER);
							txtHard.setBounds(93, 94, 120, 20);
						}
						{
							lblSoft = new Label(cptReportGroup1, SWT.NONE);
							lblSoft.setText("软件环境");
							lblSoft.setBounds(23, 126, 60, 20);
						}
						{
							txtSoft = new Text(cptReportGroup1, SWT.BORDER);
							txtSoft.setBounds(93, 124, 159, 20);
						}
						{
							lblSeverity = new Label(cptReportGroup1, SWT.NONE);
							lblSeverity.setText("严重程度");
							lblSeverity.setBounds(22, 156, 61, 17);
						}
						{
							cboSeverity = new Combo(cptReportGroup1, SWT.READ_ONLY);
							String[] items = { "致命", "严重", "一般", "提示" };
							cboSeverity.setItems(items);
							cboSeverity.select(3);
							cboSeverity.setBounds(95, 152, 84, 25);
						}
						{
							lblBugSummary = new Label(cptReportGroup2, SWT.NONE);
							lblBugSummary.setText("缺陷概要描述");
							lblBugSummary.setBounds(22, 18, 72, 17);
						}
						{
							txtBugSummary = new Text(cptReportGroup2,
									SWT.BORDER);
							txtBugSummary.setBounds(24, 43, 309, 21);
						}
						{
							lblBugDetail = new Label(cptReportGroup2, SWT.NONE);
							lblBugDetail.setText("缺陷详细描述");
							lblBugDetail.setBounds(22, 68, 79, 16);
						}
						{
							cboRecur = new Combo(cptReportGroup3, SWT.READ_ONLY);
							String[] items = { "是", "否" };
							cboRecur.setItems(items);
							cboRecur.select(0);
							cboRecur.setBounds(116, 19, 62, 25);
							cboRecur.setSize(38, 23);
							cboRecur
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											if (cboRecur.getSelectionIndex() == 0)
												txtRecurStep.setEditable(true);
											else if (cboRecur
													.getSelectionIndex() == 1){
												txtRecurStep.setText("");
												txtRecurStep.setEditable(false);
											}
												
										}
									});
						}
						{
							lblRecurStep = new Label(cptReportGroup3, SWT.NONE);
							lblRecurStep.setText("重现步骤");
							lblRecurStep.setBounds(23, 51, 65, 20);
						}
						{
							lblAttach = new Label(cptReport, SWT.NONE);
							lblAttach.setText("附件");
							lblAttach.setBounds(395, 197, 34, 19);
						}
						/*
						 * { label17 = new Label(cptReport, SWT.NONE);
						 * label17.setText("指定下一步处理"); label17.setBounds(425,
						 * 240, 88, 16); }
						 */
						{
							btnAssignReview = new Button(cptReportGroup4,
									SWT.RADIO | SWT.LEFT);
							btnAssignReview.setText("指定审核人");
							btnAssignReview.setBounds(11, 20, 95, 19);
							btnAssignReview
							.addSelectionListener(new SelectionAdapter() {
								public void widgetSelected(SelectionEvent evt) {
									cboAssignReview.setEnabled(true);
									cboClose.setEnabled(false);
								}
							});
						}
						{
							btnClose = new Button(cptReportGroup4, SWT.RADIO
									| SWT.LEFT);
							btnClose.setText("关闭");
							btnClose.setBounds(14, 50, 60, 20);
							btnClose.addSelectionListener(new SelectionAdapter() {
								public void widgetSelected(SelectionEvent evt) {
									cboAssignReview.setEnabled(false);
									cboClose.setEnabled(true);
								}
							});
						}
						{
							cboAssignReview = new Combo(cptReportGroup4,
									SWT.READ_ONLY);
							cboAssignReview.setBounds(106, 20, 100, 25);
						}
						{
							cboClose = new Combo(cptReportGroup4, SWT.READ_ONLY);
							String[] items = { "正常", "重复", "拒绝", "无效" };
							cboClose.setItems(items);
							cboClose.select(0);
							cboClose.setBounds(106, 57, 153, 25);
						}
						{
							btnSaveReport = new Button(cptReport, SWT.PUSH
									| SWT.CENTER);
							btnSaveReport.setText("修改保存");
							btnSaveReport.setBounds(435, 329, 89, 24);
							btnSaveReport.setSize(93, 26);
							btnSaveReport
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											btnSaveReportWidgetSelected(evt);
										}
									});
						}
						{
							btnSubmitReport = new Button(cptReport, SWT.PUSH
									| SWT.CENTER);
							btnSubmitReport.setText("提交");
							btnSubmitReport.setBounds(578, 329, 93, 24);
							btnSubmitReport.setSize(93, 26);
							btnSubmitReport
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											btnSubmitReportWidgetSelected(evt);
										}
									});
						}
						{
							txtBugDetail = new Text(cptReportGroup2, SWT.WRAP | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
							txtBugDetail.setBounds(26, 92, 307, 71);
						}
						{
							txtAttach = new Text(cptReport, SWT.MULTI
									| SWT.WRAP | SWT.BORDER);
							txtAttach.setBounds(451, 193, 251, 25);
						}
						{
							txtRecurStep = new Text(cptReportGroup3, SWT.WRAP | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
							txtRecurStep.setBounds(94, 58, 223, 99);
						}
						{
							lblRecur = new Label(cptReportGroup3, SWT.NONE);
							lblRecur.setText("是否重现");
							lblRecur.setBounds(23, 20, 54, 19);
						}
					}
				}
				{
					tabItem2 = new TabItem(tabFolder1, SWT.NONE);
					tabItem2.setText("      缺陷审核      ");
					{
						cptReview = new Composite(tabFolder1, SWT.NONE);
						cptReview.setLayout(null);
						cptReviewGroup1 = new Group(cptReview, SWT.NONE);
						cptReviewGroup1.setBounds(30, 10, 661, 300);
						tabItem2.setControl(cptReview);
						{
							lblComment = new Label(cptReviewGroup1, SWT.NONE);
							lblComment.setText("审核意见");
							lblComment.setBounds(38, 68, 86, 18);
						}
						{
							txtComment = new Text(cptReviewGroup1, SWT.BORDER);
							txtComment.setBounds(128, 66, 405, 18);
						}
						{
							lblAssignNext = new Label(cptReviewGroup1, SWT.NONE);
							lblAssignNext.setText("指定下一步处理");
							lblAssignNext.setBounds(30, 112, 98, 18);
						}
						{
							btnAssignResponsibility = new Button(
									cptReviewGroup1, SWT.RADIO | SWT.LEFT);
							btnAssignResponsibility.setText("指定责任人");
							btnAssignResponsibility.setBounds(80, 142, 77, 23);
							btnAssignResponsibility
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											cboAssignResponsibility
													.setEnabled(true);
										}
									});
						}
						{
							btnUserSubmit = new Button(cptReviewGroup1,
									SWT.RADIO | SWT.LEFT);
							btnUserSubmit.setText("返回提交人");
							btnUserSubmit.setBounds(80, 195, 77, 24);
							btnUserSubmit
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											cboAssignResponsibility
													.setEnabled(false);
										}
									});
						}
						{
							btnBugHang = new Button(cptReviewGroup1, SWT.RADIO
									| SWT.LEFT);
							btnBugHang.setText("问题单挂起");
							btnBugHang.setBounds(80, 244, 77, 24);
							btnBugHang
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											cboAssignResponsibility
													.setEnabled(false);
										}
									});
						}
						{
							btnSubmitReview = new Button(cptReviewGroup1,
									SWT.PUSH | SWT.CENTER);
							btnSubmitReview.setText("提交");
							btnSubmitReview.setBounds(350, 244, 100, 24);
							btnSubmitReview
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											btnSubmitReviewWidgetSelected(evt);
										}
									});
						}
						{
							cboAssignResponsibility = new Combo(
									cptReviewGroup1, SWT.READ_ONLY);
							cboAssignResponsibility
									.setBounds(203, 142, 113, 20);
						}
						{
							lblPriority = new Label(cptReviewGroup1, SWT.NONE);
							lblPriority.setText("优先级别");
							lblPriority.setBounds(38, 25, 60, 18);
						}
						{
							cboPriority = new Combo(cptReviewGroup1, SWT.READ_ONLY);
							String[] items = { "紧急", "一般", "建议" };
							cboPriority.setItems(items);
							cboPriority.select(2);
							cboPriority.setBounds(130, 25, 85, 20);
						}
					}
				}
				{
					tabItem3 = new TabItem(tabFolder1, SWT.NONE);
					tabItem3.setText("      缺陷定位      ");
					{
						composite3 = new Composite(tabFolder1, SWT.NONE);
						composite3.setLayout(null);
						composite3Group = new Group(composite3, SWT.NONE);
						composite3Group.setBounds(17, 10, 682, 336);
						tabItem3.setControl(composite3);
						{
							lblBugCause = new Label(composite3Group, SWT.NONE);
							lblBugCause.setText("缺陷原因");
							lblBugCause.setBounds(47, 53, 65, 20);
						}
						{
							lblModifyComment = new Label(composite3Group,
									SWT.NONE);
							lblModifyComment.setText("修改意见");
							lblModifyComment.setBounds(47, 90, 65, 22);
						}
						{
							txtBugCause = new Text(composite3Group, SWT.BORDER);
							txtBugCause.setBounds(130, 53, 420, 20);
						}
						{
							txtModifyComment = new Text(composite3Group,
									SWT.BORDER);
							txtModifyComment.setBounds(130, 90, 420, 22);
						}
						{
							label23 = new Label(composite3Group, SWT.NONE);
							label23.setText("指定下一步处理");
							label23.setBounds(47, 124, 91, 19);
						}
						{
							btnModifyExecute = new Button(composite3Group,
									SWT.RADIO | SWT.LEFT);
							btnModifyExecute.setText("修改实施");
							btnModifyExecute.setBounds(97, 161, 77, 24);
							btnModifyExecute
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											combo12.setEnabled(true);
										}
									});
						}
						{
							btnReviewAgain = new Button(composite3Group,
									SWT.RADIO | SWT.LEFT);
							btnReviewAgain.setText("返回重新审核");
							btnReviewAgain.setBounds(97, 197, 92, 25);
							btnReviewAgain
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											combo12.setEnabled(false);
										}
									});
						}
						{
							btnChangeReview = new Button(composite3Group,
									SWT.RADIO | SWT.LEFT);
							btnChangeReview.setText("返回审核转他人处理");
							btnChangeReview.setBounds(97, 239, 129, 27);
							btnChangeReview
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											combo12.setEnabled(false);
										}
									});
						}
						{
							button11 = new Button(composite3Group, SWT.PUSH
									| SWT.CENTER);
							button11.setText("提交");
							button11.setBounds(260, 289, 95, 28);
							button11
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											button11WidgetSelected(evt);
										}
									});
						}
						{
							combo12 = new Combo(composite3Group, SWT.READ_ONLY);
							combo12.setBounds(226, 161, 89, 20);
						}
					}
				}
				{
					tabItem4 = new TabItem(tabFolder1, SWT.NONE);
					tabItem4.setText("      缺陷修改      ");
					{
						cptModify = new Composite(tabFolder1, SWT.NONE);
						cptModify.setLayout(null);
						cptModifyGroup = new Group(cptModify, SWT.NONE);
						cptModifyGroup.setBounds(18, 10, 676, 335);

						tabItem4.setControl(cptModify);
						{
							lblModifyDescription = new Label(cptModifyGroup,
									SWT.NONE);
							lblModifyDescription.setText("修改描述");
							lblModifyDescription.setBounds(37, 48, 63, 22);
						}
						{
							lblBugAttach = new Label(cptModifyGroup, SWT.NONE);
							lblBugAttach.setText("相关附件");
							lblBugAttach.setBounds(37, 82, 63, 23);
						}
						{
							label26 = new Label(cptModifyGroup, SWT.NONE);
							label26.setText("指定下一步处理");
							label26.setBounds(37, 124, 136, 25);
						}
						{
							button12 = new Button(cptModifyGroup, SWT.RADIO
									| SWT.LEFT);
							button12.setText("重新定位");
							button12.setBounds(116, 172, 110, 30);
						}
						{
							btnValidate = new Button(cptModifyGroup, SWT.RADIO
									| SWT.LEFT);
							btnValidate.setText("提交验证人");
							btnValidate.setBounds(116, 219, 110, 30);
						}
						{
							btnSubmitModify = new Button(cptModifyGroup,
									SWT.PUSH | SWT.CENTER);
							btnSubmitModify.setText("提交");
							btnSubmitModify.setBounds(255, 287, 95, 28);
							btnSubmitModify
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											btnSubmitModifyWidgetSelected(evt);
										}
									});
						}
						{
							txtModifyDescription = new Text(cptModifyGroup,
									SWT.BORDER);
							txtModifyDescription.setBounds(134, 48, 391, 22);
						}
						{
							txtBugAttach = new Text(cptModifyGroup, SWT.BORDER);
							txtBugAttach.setBounds(134, 82, 391, 23);
						}
					}
				}
				{
					tabItem5 = new TabItem(tabFolder1, SWT.NONE);
					tabItem5.setText("      缺陷验证      ");
					{
						composite5 = new Composite(tabFolder1, SWT.NONE);
						composite5.setLayout(null);
						composite5Group = new Group(composite5, SWT.NONE);
						composite5Group.setBounds(21, 10, 667, 330);
						tabItem5.setControl(composite5);
						{
							/*
							 * label28 = new Label(composite5Group, SWT.NONE);
							 * label28.setText("指定下一不处理"); label28.setBounds(64,
							 * 159, 102, 23);
							 */
						}
						/*
						 * { button17 = new Button(composite5Group, SWT.RADIO |
						 * SWT.LEFT); button17.setText("关闭问题单");
						 * button17.setBounds(172, 194, 101, 31); }
						 */
						{
							/*
							 * button18 = new Button(composite5Group, SWT.RADIO |
							 * SWT.LEFT); button18.setText("验收不通过，返回修改人");
							 * button18.setBounds(319, 194, 170, 30);
							 */
						}
						{
							btnSubmitValidate = new Button(composite5Group,
									SWT.PUSH | SWT.CENTER);
							btnSubmitValidate.setText("提交");
							btnSubmitValidate.setBounds(250, 280, 98, 28);
							btnSubmitValidate
									.addSelectionListener(new SelectionAdapter() {
										public void widgetSelected(
												SelectionEvent evt) {
											btnSubmitValidateWidgetSelected(evt);
										}
									});
						}
						{
							composite7 = new Composite(composite5Group,
									SWT.NONE);
							composite7.setLayout(null);
							composite7.setBounds(30, 57, 585, 140);
							{
								lblValidate = new Label(composite7, SWT.NONE);
								lblValidate.setText("验证结果");
								lblValidate.setBounds(35, 32, 81, 25);
							}
							{
								btnPass = new Button(composite7, SWT.RADIO
										| SWT.LEFT);
								btnPass.setText("通过， 关闭问题单");
								btnPass.setBounds(174, 29, 127, 26);
								btnPass
										.addSelectionListener(new SelectionAdapter() {
											public void widgetSelected(
													SelectionEvent evt) {
												// button17.setSelection(true);
												// button17.setEnabled(false);
												// button18.setSelection(false);
												// button18.setEnabled(false);
											}
										});
							}
							{
								btnFailed = new Button(composite7, SWT.RADIO
										| SWT.LEFT);
								btnFailed.setText("不通过， 返回验证人");
								btnFailed.setBounds(174, 79, 150, 60);
								btnFailed
										.addSelectionListener(new SelectionAdapter() {
											public void widgetSelected(
													SelectionEvent evt) {
												// button17.setSelection(true);
												// button17.setEnabled(true);
												// button18.setSelection(false);
												// button18.setEnabled(true);
											}
										});
							}
						}
					}
				}
				{
					tabItem6 = new TabItem(tabFolder1, SWT.NONE);
					tabItem6.setText("      缺陷处理日志      ");
					{
						composite6 = new Composite(tabFolder1, SWT.NONE);
						composite6.setLayout(null);
						tabItem6.setControl(composite6);
						{
							table1 = new Table(composite6, SWT.NONE);
							table1.setBounds(0, 0, 756, 373);
							tableColumn1 = new TableColumn(table1, SWT.NONE);
							tableColumn2 = new TableColumn(table1, SWT.CENTER);
							tableColumn3 = new TableColumn(table1, SWT.CENTER);
							tableColumn4 = new TableColumn(table1, SWT.CENTER);
							tableColumn1.setText("");
							tableColumn2.setText("日期");
							tableColumn3.setText("处理人");
							tableColumn4.setText("操作描述");
							tableColumn1.setWidth(17);
							tableColumn2.setWidth(105);
							tableColumn3.setWidth(131);
							tableColumn4.setWidth(442);
							table1.setHeaderVisible(true);
						}
					}
				}
				tabFolder1.setSelection(0);
				tabFolder1.addSelectionListener(new SelectionAdapter() {
					public void widgetSelected(SelectionEvent evt) {
						tabFolder1WidgetSelected(evt);
					}
				});
			}
			/*
			 * { label1 = new Label(this, SWT.NONE); FormData label1LData = new
			 * FormData(); label1LData.width = 756; label1LData.height = 33;
			 * label1LData.left = new FormAttachment(0, 1000, 12);
			 * label1LData.top = new FormAttachment(86, 1000, 0);
			 * label1LData.right = new FormAttachment(1000, 1000, 12);
			 * label1.setLayoutData(label1LData); }
			 */
			this.layout();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void tabFolder1WidgetSelected(SelectionEvent evt) {// tab改变时触发
		if (tabFolder1.getSelectionIndex() == 5)
			InitLog();
		// box.setMessage(tabFolder1.getItem(2).getText());
		// tabFolder1.setSelection(3);
		// box.open();
	}

	private void InitLog() {
		try {
			table1.removeAll();
			SocketConnection.setCmd("getbuglog");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(EMProcess.proID);
			out.add(EMProcess.ebmsID);
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			// Color color = display.getSystemColor(SWT.COLOR_GRAY);
			Color color = new Color(display, new RGB(222, 226, 226));
			ArrayList<Object> in = SocketConnection.getListIn();
			if (in.get(0).toString().equals("-1")) {
				String[] items = { "", "", "没有任何日志信息", "" };
				TableItem item = new TableItem(table1, SWT.NONE);
				item.setText(items);
				item.setBackground(color);
				return;
			}
			int logNum = in.size() / 3;
			for (int i = 0; i < logNum; i++) {
				TableItem item = new TableItem(table1, SWT.NONE);
				item.setText(new String[] { "", in.get(i * 3).toString(),
						in.get(i * 3 + 1).toString(),
						in.get(i * 3 + 2).toString() });
				if (i % 2 == 0)
					item.setBackground(color);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void InitPreviewKnow() {
		try {
			// String tmp = wtgyms;
			// if(wtgyms.length() > 15)
			// tmp = wtgyms.substring(0, 15);
			// label1.setText("当前责任人:" + responpeo +
			// " 当前状态:" + Util.convertToStatusName(status) + " 问题概要描述:" + tmp +
			// "..."+
			// " 停留天数:" + days + "\n"
			// );
			//txtBugId.setText("D" + EMProcess.ebmsID);// bugid
			txtBugId.setText(EMProcess.ebmsID);
			txtBugId.setEditable(false);
			cboProId.setText(proID);// proid
			showModelAddUser(proID);// version
			txtBugSummary.setText(wtgyms);// gaoyaomiaoshu
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void InitShowAll() {
		try {
			InitPreviewKnow();
			SocketConnection.setCmd("getbugdetail");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(EMProcess.proID);
			out.add(EMProcess.ebmsID);
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			for (int i = 0; i < in.size(); i++)
				System.out.println(String.valueOf(i) + in.get(i));

			txtSubmit.setText(in.get(0).toString());// tijiaoren
			txtTime.setText(in.get(1).toString());// date
			cboSubsys.setText(in.get(2).toString());// model
			txtHard.setText(in.get(3).toString());// hard environment
			txtSoft.setText(in.get(4).toString());// soft environment
			cboSeverity.select(Integer.parseInt(in.get(5).toString()));// yanzhongjibie
			cboPriority.select(Integer.parseInt(in.get(6).toString()));// youxianjibie
			txtBugDetail.setText(in.get(7).toString());// xiangximiaoshu
			cboRecur.select(Integer.parseInt(in.get(8).toString()));// shifouchongxian
			txtRecurStep.setText(in.get(9).toString());// chongxianbuzhou
			txtAttach.setText(in.get(10).toString());// fujian
			if (in.get(11).toString().equals("next")) {// if("next")userid
				// "shutdown" reson
				btnAssignReview.setSelection(true);
				btnClose.setSelection(false);
				cboAssignReview.setEnabled(true);
				cboClose.setEnabled(false);
				cboAssignReview.setText(BugReportUserName.get(Util.findIdByStr(
						in.get(12).toString(), BugReportUserId)));
			} else if (in.get(11).toString().equals("shutdown")) {
				btnClose.setSelection(true);
				btnAssignReview.setSelection(false);
				cboClose.setEnabled(true);
				cboAssignReview.setEnabled(false);
				cboClose.select(Integer.parseInt(in.get(12).toString()) - 6);
			}
			txtComment.setText(in.get(13).toString());// shenheyijian
			if (in.get(14).toString().equals("next")) {// if(next)userid
				// shutdown
				btnAssignResponsibility.setSelection(true);
				btnUserSubmit.setSelection(false);
				btnBugHang.setSelection(false);
				cboAssignResponsibility.setText(BugReportUserName.get(Util
						.findIdByStr(in.get(15).toString(), BugReportUserId)));
			}
			txtBugCause.setText(in.get(16).toString());// quexianyuanyin
			txtModifyComment.setText(in.get(17).toString());// xiugaixijian
			if (in.get(18).toString().equals("next")) {// if(next)userid
				// shutdown
				btnModifyExecute.setSelection(true);
				btnReviewAgain.setSelection(false);
				btnChangeReview.setSelection(false);
				combo12.setText(BugReportUserName.get(Util.findIdByStr(in.get(
						19).toString(), BugReportUserId)));
			}
			txtModifyDescription.setText(in.get(20).toString());// xiugaimiaoshu
			txtBugAttach.setText(in.get(21).toString());// fujian
			if (in.get(22).toString().equals("next")) {// if next shutdown
				btnValidate.setSelection(true);
				button12.setSelection(false);
			}
			if (in.get(23).toString().equals("1")) {// 0/1
				btnPass.setSelection(false);
				btnFailed.setSelection(true);
			} else if (in.get(23).toString().equals("0")) {
				btnFailed.setSelection(false);
				btnPass.setSelection(true);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void InitProId() {
		try {
			BugReportProjectId.clear();
			BugReportProjectName.clear();
			SocketConnection.setCmd("getallproject");
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();

			if (in.get(0).toString().equals("-1")) {
				String items[] = { "无项目" };
				cboProId.setItems(items);
			} else {
				int count = in.size() / 2;
				String items[] = new String[count];
				for (int i = 0; i < count; i++) {
					BugReportProjectId.add(in.get(2 * i).toString());
					BugReportProjectName.add(in.get(2 * i + 1).toString());
					items[i] = in.get(2 * i).toString();
				}
				cboProId.setItems(items);
				cboProId.select(0);
			}
			showModelAddUser(cboProId.getText());
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void showModelAddUser(String proid) {// 添加报告单，模块
		try {
			BugReportUserId.clear();
			BugReportUserName.clear();
			if (cboProId.getText().equals("无项目"))
				return;
			SocketConnection.setCmd("getprojectdetailinfo");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(proid);
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			// 显示项目所有信息
			//cboProVersion.setText(in.get(1).toString()); // version
			String[] versions = {in.get(1).toString()};
			cboProVersion.setItems(versions);
			cboProVersion.select(0);
			
			int modelNum = Integer.parseInt(in.get(2).toString());
			String[] items = null;
			if (modelNum != 0) {
				items = new String[modelNum];
				for (int i = 0; i < modelNum; i++)
					items[i] = in.get(i + 3).toString();
				cboSubsys.setItems(items);
				cboSubsys.select(0);
			} else
				cboSubsys.removeAll();
			int userNum = Integer.parseInt(in.get(modelNum + 3).toString());
			String[] userItems = null;
			if (userNum != 0) {
				userItems = new String[userNum];
				for (int i = 0; i < userNum; i++) {
					BugReportUserId
							.add(in.get(modelNum + 4 + 2 * i).toString());
					BugReportUserName.add(in.get(modelNum + 4 + 2 * i + 1)
							.toString());
				//	userItems[i] = in.get(modelNum + 4 + 2 * i + 1).toString();
					userItems[i] = in.get(modelNum + 4 + 2 * i + 1).toString()+"("
					               +in.get(modelNum + 4 + 2 * i).toString()+")";
				}
				cboAssignReview.removeAll();
				cboAssignReview.setItems(userItems);
				cboAssignReview.select(0);
				cboAssignResponsibility.removeAll();
				cboAssignResponsibility.setItems(userItems);
				cboAssignResponsibility.select(0);
				combo12.removeAll();
				combo12.setItems(userItems);
				combo12.select(0);
			} else {
				cboAssignReview.removeAll();
				cboAssignResponsibility.removeAll();
				combo12.removeAll();
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void InitAll() {
		try {
			InitPreviewKnow();
			InitShowAll();
			if (status.equals("0")) {// 草稿
				tabFolder1.setSelection(0);
				cptReport.setEnabled(true);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
				btnSaveReport.setEnabled(true);
				btnSubmitReport.setEnabled(true);
			} else if (status.equals("1")) {// 新建
				tabFolder1.setSelection(1);
				cptReport.setEnabled(false);
				cptReview.setEnabled(true);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
				btnAssignResponsibility.setSelection(true);
				btnUserSubmit.setSelection(false);
				btnBugHang.setSelection(false);
				cboAssignResponsibility.setEnabled(true);
			} else if (status.equals("2")) {// 定位
				tabFolder1.setSelection(2);
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(true);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
				btnModifyExecute.setSelection(true);
				combo12.setEnabled(true);
				btnReviewAgain.setSelection(false);
				btnChangeReview.setSelection(false);
			} else if (status.equals("3")) {// 修改
				tabFolder1.setSelection(3);
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(true);
				composite5.setEnabled(false);
				button12.setSelection(true);
				btnValidate.setSelection(false);
			} else if (status.equals("4")) {// 验证
				tabFolder1.setSelection(4);
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(true);
				btnPass.setSelection(true);
				btnFailed.setSelection(false);
				// button17.setSelection(true);
				// button17.setEnabled(false);
				// button18.setSelection(false);
				// button18.setEnabled(false);
			} else if (status.equals("5")) {// 挂起
				tabFolder1.setSelection(5);
				InitLog();
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
			} else if (status.equals("6")) {// 正常关闭
				tabFolder1.setSelection(5);
				InitLog();
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
			} else if (status.equals("7")) {// 重复关闭
				tabFolder1.setSelection(5);
				InitLog();
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
			} else if (status.equals("8")) {// 拒绝关闭
				tabFolder1.setSelection(5);
				InitLog();
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
			} else {// "其它","无效"
				tabFolder1.setSelection(5);
				InitLog();
				cptReport.setEnabled(false);
				cptReview.setEnabled(false);
				composite3.setEnabled(false);
				cptModify.setEnabled(false);
				composite5.setEnabled(false);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void submitDraftBug() {
		ArrayList<Object> out = new ArrayList<Object>();
		String bidStr = ebmsID;// txtBugId.getText().trim();
		String pidStr = cboProId.getText().trim();
		/*
		 * int start; for(start = 0; start < bidStr.length(); start++) { if
		 * (bidStr.charAt(start) != '0') break; } if (start >= bidStr.length())
		 * return; bidStr = bidStr.substring(start);
		 */
		out.add(pidStr);
		out.add(bidStr);
		SocketConnection.setListOut(out);
		try {
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
		} catch (IOException e) {
			e.printStackTrace();
			box.setMessage("提交失败!");
			box.open();
			return;
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			box.setMessage("提交失败!");
			box.open();
			return;
		}
		ArrayList<Object> in = SocketConnection.getListIn();
		if (in == null || in.size() == 0 || in.get(0) == null
				|| in.get(0).toString().equals("-1")) {
			box.setMessage("提交失败!");
			box.open();
		} else {
			box.setMessage("操作成功!");
			box.open();
		}
	}

	private void newBug() {// 创建缺陷报告单
		try {
		

			ArrayList<Object> out = new ArrayList<Object>();
			out.add(proID);// proid
			//out.add(txtBugId.getText());
			out.add(ebmsID);
			out.add(userName);// person
			out.add(txtTime.getText());// time
			out.add(cboSubsys.getText());// model name
			if (txtHard.getText().trim().equals("")) {
				box.setMessage("硬件环境不能为空");
				box.open();
				return;
			} else
				out.add(txtHard.getText());

			if (txtSoft.getText().equals("")) {
				box.setMessage("软件环境不能为空");
				box.open();
				return;
			} else
				out.add(txtSoft.getText());
			
			out.add(cboSeverity.getSelectionIndex());
			
			if (txtBugSummary.getText().equals(""))// 概要描述
			{
				box.setMessage("缺陷概要描述不能为空");
				box.open();
				return;
			} 
			else
				out.add(txtBugSummary.getText());
			
			if (txtBugDetail.getText().trim().equals("")) {
				box.setMessage("缺陷详细描述不能为空");
				box.open();
				return;
			} else
				out.add(txtBugDetail.getText());
			
			out.add(cboRecur.getSelectionIndex());
			
			if (cboRecur.getSelectionIndex()==0&&txtRecurStep.getText().trim().equals("")) {
				box.setMessage("重现步骤不能为空");
				box.open();
				return;
			} else
				out.add(txtRecurStep.getText());

			if (txtAttach.getText().equals(""))
				out.add(" ");
			else
				out.add(txtAttach.getText());
			
			if (btnAssignReview.getSelection()) { // 不关闭
				out.add("next");
				/*out.add(BugReportUserId.get(Util.findIdByStr(cboAssignReview
						.getItem(cboAssignReview.getSelectionIndex()),
						BugReportUserName)));*/
				out.add(Util.splitUserNameId(cboAssignReview.getItem(cboAssignReview.getSelectionIndex()))[1]);
			} else {
				out.add("shutdown");
				out.add(cboClose.getSelectionIndex() + 6);
			}
			for (int i = 0; i < out.size(); i++)
				System.out.println(out.get(i));
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			if (in.get(0).toString().equals("-1")) {
				box2.setMessage("添加失败!");
				box2.open();
				return;
			} else {
				box.setMessage("操作成功!");
				box.open();
				//txtBugId.setText("D" + in.get(0).toString());
				txtBugId.setText(EMProcess.ebmsID);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void btnSaveReportWidgetSelected(SelectionEvent evt) {
		SocketConnection.setCmd("newbugsave");
		newBug();
	}

	private void btnSubmitReportWidgetSelected(SelectionEvent evt) {
		box1.setMessage("你确定要提交吗？");
		if (box1.open() == SWT.NO)
			return;
		// if (txtBugId.getText() == null || txtBugId.getText().trim().length()
		// == 0)
		if (ebmsID == null || ebmsID.length() == 0) {
			SocketConnection.setCmd("newbugsubmit");
			newBug();
		} else {
			SocketConnection.setCmd("submitdraftbug");
			submitDraftBug();
		}
		shell.close();
	}

	private void btnSubmitReviewWidgetSelected(SelectionEvent evt) {// 审核 提交
		box1.setMessage("你确定要提交吗？");
		if (box1.open() == SWT.NO)
			return;
		try {
			SocketConnection.setCmd("checkbug");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(proID);
			out.add(ebmsID);
			out.add(userName);
			out.add(cboPriority.getSelectionIndex());
			if (txtComment.getText().trim().equals("")) {
				box.setMessage("审核意见不能为空!");
				box.open();
				return;
			} else
				out.add(txtComment.getText());

			if (btnAssignResponsibility.getSelection()) {
				out.add("next");
				/*out.add(BugReportUserId.get(Util.findIdByStr(
						cboAssignResponsibility.getText(), BugReportUserName)));*/
				out.add(Util.splitUserNameId(cboAssignResponsibility.getItem(cboAssignResponsibility.getSelectionIndex()))[1]);
			}
			if (btnUserSubmit.getSelection()) {
				out.add("back");
				out.add(txtSubmit.getText());
			}
			if (btnBugHang.getSelection()) {
				out.add("shutdown");
				out.add(" ");
			}
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			if (in.get(0).equals("1")) {
				box.setMessage("提交成功！");
				box.open();
				shell.close();
				return;
			} else if (in.get(0).equals("-1")) {
				box2.setMessage("提交失败！");
				box2.open();
				return;
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void button11WidgetSelected(SelectionEvent evt) {// 定位 提交
		box1.setMessage("你确定要提交吗？");
		if (box1.open() == SWT.NO)
			return;
		try {
			SocketConnection.setCmd("locatebug");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(proID);
			out.add(ebmsID);
			out.add(userName);
			if (txtBugCause.getText().trim().equals(""))// 修改原因
			{
				box.setMessage("缺陷原因不能为空!");
				box.open();
				return;
			} else
				out.add(txtBugCause.getText());

			if (txtModifyComment.getText().trim().equals(""))// 修改意见
			{
				box.setMessage("修改意见不能为空!");
				box.open();
				return;
			} else
				out.add(txtModifyComment.getText());

			if (btnModifyExecute.getSelection()) {
				out.add("next");
				//out.add(BugReportUserId.get(Util.findIdByStr(combo12.getText(),
					//	BugReportUserName)));
				out.add(Util.splitUserNameId(combo12.getItem(combo12.getSelectionIndex()))[1]);
			} else if (btnReviewAgain.getSelection()
					|| btnChangeReview.getSelection()) {
				out.add("back");
				/*out.add(BugReportUserId.get(Util.findIdByStr(cboAssignReview
						.getText(), BugReportUserName)));*/
				out.add(Util.splitUserNameId(cboAssignReview.getItem(cboAssignReview.getSelectionIndex()))[1]);
			}
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			if (in.get(0).equals("1")) {
				box.setMessage("提交成功！");
				box.open();
				shell.close();
				return;
			} else if (in.get(0).equals("-1")) {
				box2.setMessage("提交失败！");
				box2.open();
				return;
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void btnSubmitModifyWidgetSelected(SelectionEvent evt) {// 修改 提交
		box1.setMessage("你确定要提交吗？");
		if (box1.open() == SWT.NO)
			return;
		try {
			SocketConnection.setCmd("fixbug");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(proID);
			out.add(ebmsID);
			out.add(userName);

			if (txtModifyDescription.getText().equals(""))// 修改描述
			{
				box.setMessage("修改描述不能为空");
				box.open();
				return;
			} else
				out.add(txtModifyDescription.getText());

			if (txtBugAttach.getText().equals(""))// 修改附件
				out.add(" ");
			else
				out.add(txtBugAttach.getText());

			if (btnValidate.getSelection()) {
				out.add("next");
				out.add(txtSubmit.getText());
			} else if (button12.getSelection()) {
				out.add("back");
				/*out.add(BugReportUserId.get(Util.findIdByStr(
						cboAssignResponsibility.getText(), BugReportUserName)));*/
				out.add(Util.splitUserNameId(cboAssignReview.getItem(cboAssignReview.getSelectionIndex()))[1]);
			}

			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			if (in.get(0).equals("1")) {
				box.setMessage("提交成功！");
				box.open();
				shell.close();
				return;
			} else if (in.get(0).equals("-1")) {
				box2.setMessage("提交失败！");
				box2.open();
				return;
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void btnSubmitValidateWidgetSelected(SelectionEvent evt) {// 验证 提交
		box1.setMessage("你确定要提交吗？");
		if (box1.open() == SWT.NO)
			return;
		try {
			SocketConnection.setCmd("verifybug");
			ArrayList<Object> out = new ArrayList<Object>();
			out.add(proID);
			out.add(ebmsID);
			out.add(userName);
			if (btnPass.getSelection()) {
				out.add("1");
				out.add("shutdown");
			} else if (btnFailed.getSelection()) {
				out.add("0");
				out.add("back");
			}
			// if(button17.getSelection())
			// out.add("shutdown");
			// else if(button18.getSelection())
			// out.add("back");
			SocketConnection.setListOut(out);
			SocketConnection.DataTransmission();
			if (SocketConnection.getListIn() == null || SocketConnection.getListIn().size() == 0)
			{
				box.setMessage("服务器连接出错，请检查配置文件和网络连接！");
				box.open();
				//return;
				System.exit(0);
			}
			
			ArrayList<Object> in = SocketConnection.getListIn();
			if (in == null || in.size() == 0) {
				box2.setMessage("通信失败！");
				box2.open();
			} else if (in.get(0).equals("1")) {
				box.setMessage("提交成功！");
				box.open();
				shell.close();
			} else if (in.get(0).equals("-1")) {
				box2.setMessage("提交失败！");
				box2.open();
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
}
